package com.cbhb.sys;

import java.util.Arrays;

public class twoSum {
    public static int[] twoSum(int[] nums, int target) {
        int start = 0;
        int end = 1;
        for (int s = 0; s < nums.length; s ++) {
            for (int e = s + 1; e < nums.length; e ++) {
                if (nums[e] == target - nums[s]) {
                    start = s;
                    end = e;
                }
            }
        }
        return new int[]{start, end};
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(twoSum(new int[]{3, 8, 9, 23}, 17)));
    }
}
